<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 用户输入秒数，可以自动转换为时分秒
        let second = +prompt(`请输入秒数`)
        function getTime(t) {
            // 时分秒转换
            let h = Math.floor(t / 60 / 60 % 24)
            let m = Math.floor(t / 60 % 60)
            let s = Math.floor(t % 60)

            // 时分秒补零操作
            h = h < 10 ? "0" + h : h
            m = m < 10 ? "0" + m : m
            s = s < 10 ? "0" + s : s

            // 输出时分秒
            return `转换后为:${h}时${m}分${s}秒`

        }
        let str = getTime(second)
        alert(str)

    </script>
</body>

</html>